package string;

import java.util.Scanner;

public class test3 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String str=sc.nextLine();
        int index1=str.lastIndexOf(" ");
        int index2=str.length()-1;
        System.out.println(index2-index1);
    }
}
